//
//  JYVisitorView.swift
//  WeiBoDemo
//
//  Created by 万佳阳 on 16/8/1.
//  Copyright © 2016年 JYWan. All rights reserved.
//

import UIKit

class JYVisitorView: UIView {
    // MARK:- 加载xib的类方法
    class func visitorView() -> JYVisitorView {
        return NSBundle.mainBundle().loadNibNamed("JYVisitorView", owner: nil, options: nil).first as! JYVisitorView
    }

    // MARK:- 控件的属性
    @IBOutlet weak var rotationView: UIImageView!
    
    @IBOutlet weak var iconView: UIImageView!
    @IBOutlet weak var tipLabel: UILabel!
    @IBOutlet weak var registerBtn: UIButton!
    @IBOutlet weak var loginBtn: UIButton!
    
    // MARK:- 自定义函数
    func setupVisitorViewInfo(iconName : String, title : String) {
        iconView.image = UIImage(named: iconName)
        tipLabel.text = title
        rotationView.hidden = true
        
    }
    
    func addRotationAnimation() {
        //创建动画
        let anima = CABasicAnimation(keyPath: "transform.rotation.z")
        anima.fromValue = 0
        anima.toValue = M_PI * 2
        anima.repeatCount = MAXFLOAT
        anima.duration = 5
        anima.removedOnCompletion = false
        
        //添加动画
        rotationView.layer .addAnimation(anima, forKey: nil)
    }
}
